home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9288 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: argc/argv & switches
  5. Date: 9 Mar 1996 04:07:11 GMT
  6. Organization: Nando.net Public Access
  7. Message-ID: <4hr05f$2gs@castle.nando.net>
  8. References: <4h2j8j$9gn@milo.freenet.vancouver.bc.ca> <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca> <danpop.826238070@rscernix> <4ho9dv$bcb@castle.nando.net> <4hodbuINNlvv@keats.ugrad.cs.ubc.ca>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail1912.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <4hodbuINNlvv@keats.ugrad.cs.ubc.ca>, c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  14. >In article <4ho9dv$bcb@castle.nando.net>,
  15. >Bill McCarthy <actuary@nando.net> wrote:
  16. > >In <danpop.826238070@rscernix>,
  17. > >danpop@mail.cern.ch (Dan Pop) writes:
  18. > >
  19. > >>In <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca>
  20. > >>c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  21. > >>
  22. > >>>However, if it were the case that these pointers are not modifiable, 
  23. > >>
  24. > >>It _is_ the case.  An attempt to modify a pointer from the argv "array" 
  25. > >>results in undefined behaviour.
  26. > >
  27. > >According to Herbert Schildt, 5.1.2.2.1 states "The parameters argc and
  28. > >argv and the strings pointed to by the argv array shall be modifiable
  29. > >by the program, and retain their last-stored values between program
  30. > >startup and program termination."
  31. > >
  32. > >I'm just reading the standard for the first time, and am only up to page
  33. > >26 :-( so be kind - what am I missing?
  34. >
  35. >You are missing the observation that argv is a pointer to an array of objects.
  36. >These objects are pointers to char. Although argv is modifiable, these char
  37. >pointers are not. The funny thing is that the data they point to _is_
  38. >modifiable.
  39.  
  40. Actually, I understood the standard.  I misread Dan Pop's comment.  I reread
  41. the comment and, as unual, Dan is quite clearly referring to the pointers --
  42. not the strings.
  43.  
  44. Bill McCarthy
  45. actuary@nando.net
  46. Wendell, NC  USA
  47.  
  48.